layui.use(['grid', 'layarea', 'laydate'], function () {
    var pager = layui.grid
        , layarea = layui.layarea
        , laydate = layui.laydate
        , tableId = "drug-table"
        , tableFilter = "drug-table-filter"
        , searchFilter = "drug-search"
        , cols = [
            {field: "_serial", title: "序号"},
            {field: "title", title: "药品名称"},
            {field: "category", title: "药品类别"},
            {field: "dosage_form", title: "药品剂型"},
            {field: "risk", title: "风险累及系统-器官"},
            {field: "reported_at", title: "上报时间"},
            {field: "unit", title: "上报单位"},
            {field: "address", title: "所属地区"},
            {field: "phone", title: "联系电话"},
            {field: "remark", title: "备注"},
            {field: "checked_at", title: "处理时间"},
            {field: "status", title: "处理状态"},
            {field: "comment", title: "风险评价"},
        ]
        , table = {
            "id": tableId,
            "elem": "#" + tableId,
            "limit": 8,
            "limits": [10, 20, 50, 100],
            "cols": [cols],
            "method": "post",
            "request": {"pageName": "page", "limitName": "per-page"},
            "url": "/report-summary-list",
            "toolbar": "#toolBar",
            "page": {"hash": "fenye"},
            "autoSort": false,
            "defaultToolbar": []
        }
        , eventOptions = {}
        , events = {}

    layarea.render({
        elem: '#'+ searchFilter,
        change: function (res) {
            //选择结果
            console.log(res)
        }
    });

    laydate.render({
        elem: '#yak_dt_s'
    });

    laydate.render({
        elem: '#yak_dt_e'
    });

    pager.render({
        "searchFilter": searchFilter,
        "tableId": tableId,
        "tableFilter": tableFilter,
        "sort": "server",
        "countCache": true,
        "table": table,
        "editor": {},
        "eventOptions": eventOptions
    }, events)
})
